package com.kungkhies.mvc.restless;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.kungkhies.domain.kungkher.Kungkher;
import com.kungkhies.domain.kungkhie.KungkhieSummary;
import com.kungkhies.services.kungkher.KungkherService;

@Controller
@RequestMapping("/displayKungkhies.htm")
public class DisplayKungkhiesForKungkherController
{
    @RequestMapping(method = RequestMethod.GET)
    public String showKungkhiesForKungkher(
            @RequestParam("kungkherId") long kungkherId,
            Map<String, Object> model)
    {

        Kungkher kungkher = kungkherService.getKungkher(kungkherId);
        List<KungkhieSummary> kungkhies =
                kungkherService.getKungkhiesForKungkher(kungkher);
        model.put("kungkhies", kungkhies);

        return "kungkhies/list";
    }
    @Autowired
    KungkherService kungkherService;
}
